package com.doudanhua.basecode.mvc.utils;

import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;

/**
 * @Author zhangqian
 * @Description TODO
 * @Date 2022/11/9 20:43
 */
public abstract class ExceptionUtils {
    public static String getFullMsg(Exception exp) {
        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw);

        try {
            exp.printStackTrace(pw);
            return exp + ": " + sw.toString();
        } finally {
            pw.close();
            try {
                sw.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
